package com.bawei.shopping2.http

import com.bawei.shopping2.entity.*
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface ApiService {
    //登陆
    @POST(Const.LOGIN_URL)
    suspend fun login(@Body requestBody: RequestBody):ApiResponse<UserEntity>
    //注册
    @POST(Const.REGISTER_URL)
    suspend fun register(@Body requestBody: RequestBody):ApiResponse<UserEntity>
    //商品一级分类
    @GET(Const.CATEGORY_MAIN_URL)
    suspend fun mainCategory():ApiResponse<MutableList<CategoryEntity>>
    //商品二级分类
    @GET(Const.CATEGORY__URL)
    suspend fun category(@Query("parent_id") parent_id:Int):ApiResponse<MutableList<CategoryEntity>>
    //商品信息
    @GET(Const.GOODS_URL)
    suspend fun goods(@Query("category_id") category_id:Int,@Query("currentPage") currentPage:Int,@Query("pageSize") pageSize:Int):ApiResponse<MutableList<GoodsEntity>>
    //轮播图
    @GET(Const.BANNER_URL)
    suspend fun  banners():ApiResponse<MutableList<BannerEntity>>
    //商品详情
    @GET(Const.GOODS_DETAIL_URL)
    suspend fun goodsDetail(@Query("goods_id") goods_id:Int):ApiResponse<GoodsEntity>
    //添加购物车
    @POST(Const.ADD_CAR_URL)
    suspend fun addCar(@Body requestBody: RequestBody):ApiResponse<String>
    //查看购物车
    @GET(Const.SELECT_CAR_URL)
    suspend fun selectCar():ApiResponse<MutableList<CarGoodsEntity>>
    //删除购物车
    @POST(Const.DELETE_CAR_URL)
    suspend fun deleteCar(@Body requestBody: RequestBody):ApiResponse<String>



}